/*
 * Copyright (c) 2020.
 * http://www.ulabcare.com
 */

package com.mt.roll.core.config;

import lombok.Data;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotNull;

/**
 * @author jiff
 * @date 2020-03-10
 * @since 1.0
 */
@Component
@ConditionalOnProperty(prefix = "roll.wechat", name = {"ma.appId"})
@ConfigurationProperties(prefix = "roll.wechat")
@Data
@Validated
public class WxConfig {

    private String mchId;
    private String mchKey;
    @NotNull
    private WechatProperties ma;


    @Data
    public static class WechatProperties {
        /**
         * 应用ID
         */
        private String appId;
        /**
         * 接口秘钥
         */
        private String appSecret;
        /**
         * 微信公众号开发模式接口配置信息中的Token保持一致
         */
        private String token;
        /**
         * 微信生成的 ASEKey
         */
        private String aseKey;
        /**
         * 商户号
         */
        private String mchId;
        /**
         * 商户秘钥
         */
        private String mchKey;

        /**
         * 证书路径
         */
        private String keyPath;
    }


}
